package travlefate.story.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * @author keven
 * @data 15/12/21 下午2:05
 * @package travlefate.story.base
 */

public abstract class BaseFragment extends Fragment {


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View view = initLayout(container);

        initViews(view);

        initClick();

        initDatas();

        return view;
    }

    /**
     * 初始化数据
     */
    protected abstract void initDatas();

    /**
     * 设置所有的监听
     */
    protected abstract void initClick();


    /**
     * 初始化视图
     * @param view
     */
    protected abstract void initViews(View view);

    /**
     * 加载布局
     * @param container
     * @return
     */
    protected abstract View initLayout(ViewGroup container);


}
